﻿using Camc.Quality.Dto.ProcessesEntityDto;
using System;
using System.Collections.Generic;

namespace Camc.Quality.TechDoc
{
    public class TechDocDto
    {
        public TechDocDto()
        {
            Procs = new List<ProcessesDto>();
            Materials = new List<TechDocMaterialDto>();
        }


        public TechDocDto(string uid, string codeId, string modelCode, string phase, string drawingCode,
            string drawingName,
            string editor, DateTime editTime, string url, string deptId)
        {
            SysId = uid;
            CodeId = codeId;
            ModelCode = modelCode;
            Phase = phase;
            DrawingCode = drawingCode;
            DrawingName = drawingName;
            Editor = editor;
            EditTime = editTime;
            Url = url;
            DeptId = deptId;

            Procs = new List<ProcessesDto>();
            Materials = new List<TechDocMaterialDto>();
        }

        public virtual string SysId { get; set; }

        /// <summary>
        /// PPS工规编号
        /// </summary>
        public virtual string CodeId { get; set; }

        /// <summary>
        /// 产品型号
        /// </summary>
        public virtual string ModelCode { get; set; }

        public virtual string Phase { get; set; }

        /// <summary>
        /// 图号
        /// </summary>
        public virtual string DrawingCode { get; set; }

        /// <summary>
        /// 图号名称
        /// </summary>
        public virtual string DrawingName { get; set; }

        /// <summary>
        /// 编者
        /// </summary>
        public virtual string Editor { get; set; }

        /// <summary>
        /// 编辑时间
        /// </summary>
        public virtual DateTime EditTime { get; set; }

        /// <summary>
        /// PPS工规地址
        /// </summary>
        public virtual string Url { get; set; }

        /// <summary>
        /// 部门名称 
        /// </summary>
        public virtual string DeptId { get; set; }

        public virtual ICollection<ProcessesDto> Procs { get; set; }

        public virtual ICollection<TechDocMaterialDto> Materials { get; set; }
    }

    public class TechDocEquipmentDto
    {
        public TechDocEquipmentDto(int procId, long erpid, string name, string spec, string remark, string isNecessary)
        {
            ProcID = procId;
            ERPID = erpid;
            Name = name;
            Spec = spec;
            Remark = remark;
            IsNecessary = isNecessary;
        }

        public virtual int ProcID { get; set; }
        public virtual long ERPID { get; set; }
        public virtual string Name { get; set; }
        public virtual string Spec { get; set; }

        public virtual string Remark { get; set; }
        public virtual string IsNecessary { get; set; }

    }

    public class TechDocToolingDto
    {
        public TechDocToolingDto()
        {
        }


        /// <summary>
        /// 
        /// </summary>
        public string ProcID { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public string Spec { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public string Name { get; set; }
    }

    public class TechDocProcDto
    {
        public TechDocProcDto()
        {
            Equipments = new List<TechDocEquipmentDto>();
            Toolings = new List<TechDocToolingDto>();
        }

        public TechDocProcDto(int id, string name, string workerCategory, string content,
            string property, decimal chunk)
        {
            Id = id;
            Name = name;
            WorkerCategory = workerCategory;
            Content = content;
            Chunk = chunk;
            Property = property;

            Equipments = new List<TechDocEquipmentDto>();
            Toolings = new List<TechDocToolingDto>();
        }

        /// <summary>
        /// 工序序号
        /// </summary>
        public virtual int Id { get; set; }

        /// <summary>
        /// 工序名称
        /// </summary>
        public virtual string Name { get; set; }

        /// <summary>
        /// 工时
        /// </summary>
        public virtual decimal Chunk { get; set; }

        /// <summary>
        /// 工种
        /// </summary>
        public virtual string WorkerCategory { get; set; }

        /// <summary>
        /// 内容
        /// </summary>
        public virtual string Content { get; set; }

        /// <summary>
        /// 性质
        /// </summary>
        public virtual string Property { get; set; }


        public virtual ICollection<TechDocEquipmentDto> Equipments { get; set; }
        public virtual ICollection<TechDocToolingDto> Toolings { get; set; }
    }

    public class TechDocMaterialDto
    {
        public TechDocMaterialDto()
        {
        }

        public TechDocMaterialDto(string category, string size, string length, string productAmount,
            string weightPerProduct, string weight, string grade, string standard, string hardness, string remark,
            string name = null, string materialState = null, string specification = null)
        {
            Category = category;
            Size = size;
            Length = length;
            ProductAmount = productAmount;
            WeightPerProduct = weightPerProduct;
            Weight = weight;
            Grade = grade;
            Standard = standard;
            Hardness = hardness;
            Remark = remark;
            Name = name;
            MaterialState = materialState;
            Specification = specification;
        }


        /// <summary>
        /// 种类
        /// </summary>
        public virtual string Category { get; set; }

        /// <summary>
        /// 刨面尺寸
        /// </summary>
        public virtual string Size { get; set; }

        /// <summary>
        /// 长度
        /// </summary>
        public virtual string Length { get; set; }

        /// <summary>
        /// 材料/产品，一出几
        /// </summary>
        public virtual string ProductAmount { get; set; }

        /// <summary>
        /// 单间质量
        /// </summary>
        public virtual string WeightPerProduct { get; set; }

        /// <summary>
        /// 全套质量
        /// </summary>
        public virtual string Weight { get; set; }

        /// <summary>
        /// 材料牌号
        /// </summary>
        public virtual string Grade { get; set; }

        /// <summary>
        /// 标准代号
        /// </summary>
        public virtual string Standard { get; set; }


        /// <summary>
        /// 硬度
        /// </summary>
        public virtual string Hardness { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public virtual string Remark { get; set; }

        /// <summary>
        /// 材料名称
        /// </summary>
        public virtual string Name { get; set; }


        /// <summary>
        /// 材料状态
        /// </summary>
        public virtual string MaterialState { get; set; }


        /// <summary>
        /// 材料规格
        /// </summary>
        public virtual string Specification { get; set; }
    }
}
